package com.wanmait.wanmarecruit.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wanmait.wanmarecruit.entity.PositionType;
import com.wanmait.wanmarecruit.service.PositionTypeSecondService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wanmait.wanmarecruit.mapper.PositionTypeSecondMapper;
import com.wanmait.wanmarecruit.entity.PositionTypeSecond;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class PositionTypeSecondServiceImpl extends ServiceImpl<PositionTypeSecondMapper, PositionTypeSecond> implements PositionTypeSecondService {

    @Resource
    private PositionTypeSecondMapper positionTypeSecondMapper;

    @Override
    public List<PositionTypeSecond> getPositionTypeSecondByPositionTypeId(Integer positionTypeId) {
        LambdaQueryWrapper<PositionTypeSecond> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PositionTypeSecond::getPositionTypeId,positionTypeId);
        List<PositionTypeSecond> positionTypeSeconds = this.list(queryWrapper);
        return positionTypeSeconds;
    }

    @Override
    public List<PositionTypeSecond> getAllPositionTypeSecond() {
        LambdaQueryWrapper<PositionTypeSecond> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(PositionTypeSecond::getTypeName,PositionTypeSecond::getPositionTypeId);
        return list(queryWrapper);
    }

    @Override
    public List<PositionTypeSecond> getTypeByPositionTypeId(Integer positionTypeId) {
        LambdaQueryWrapper<PositionTypeSecond> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PositionTypeSecond::getPositionTypeId,positionTypeId);
        return this.list(queryWrapper);
    }
}
